﻿using System;

//https://developer.android.com/google/gcm/server.html
//https://developer.android.com/google/gcm/http.html
/**Example:
 * 
{ "collapse_key": "score_update",
  "time_to_live": 108,
  "delay_while_idle": true,
  "data": {
    "score": "4x8",
    "time": "15:16.2342"
  },
  "registration_ids":["4", "8", "15", "16", "23", "42"]
}
 * 
 **/

namespace FollowMe.GCM
{

    //this will get converted to a string, so force programmers to format the message with tostring etc!
    public class GCMMessage<T>  where T : class
    {
        public String registration_id;
        public string[] registration_ids;
        public String notification_key;
        //this is our message type!  It prevents multiple messages from being sent
        //each message will replace the previous, so be careful if the messages are unique
        public String collapse_key;

        /**
         * This parameter specifies a JSON object whose fields represents the key-value pairs of the message's payload data. 
         * If present, the payload data will be included in the Intent as application data, with the key being the extra's name.
         * For instance, "data":{"score":"3x1"} would result in an intent extra named score whose value is the string 3x1. 
         * There is no limit on the number of key/value pairs, though there is a limit on the total size of the message (4kb). 
         **/
        public T data;

        public String delay_while_idle; //must be json boolean, do not send on device idle. (optional)

        public String time_to_live; //(max 4 weeks), in seconds, time to live on GCM server

        public String restricted_package_name; //set to our android app package name!

        public String dry_run; //Optional, boolean, for testing requests.
    }
}
